import { cache } from "./../../common/config/adapter";
import Base from "./base";
const tableName = `admin_user`;
export default class extends Base {
  static get _REST() {
    return true;
  }
  async postAction() {
    const file = this.file("file");

    const fileService = think.service("file");
    const result = await fileService.uploadAiImg(file).catch((err: any) => {
      return think.isError(err) ? err : new Error(err);
    });

    if (think.isError(result)) {
      // 这里将错误信息返回，或者返回格式化后的错误信息也都可以
      return this.fail(1000, result.message);
    }

    return this.success(result);
  }
}
